home *** CD-ROM | disk | FTP | other *** search
- Path: homer23.u.washington.edu!quanger
- From: "Q. Sun" <quanger@u.washington.edu>
- Newsgroups: comp.lang.c
- Subject: Processor Fault!!??
- Date: Sun, 28 Jan 1996 01:13:18 -0800
- Organization: University of Washington
- Message-ID: <Pine.A32.3.91j.960128010358.43648E-100000@homer23.u.washington.edu>
- NNTP-Posting-Host: homer23.u.washington.edu
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=US-ASCII
- NNTP-Posting-User: quanger
-
-
- I was doing some examples off a text we are using and I am having
- problems with it. The chapter is on arrays and I type in and ran the
- programs in the text. When I ran it using Turbo C++ 3.1 it gave a nasty
- General Protection Fault and stating it's the processor's fault! It also
- said things like "0x211F:0x00BE Processor Fault." In Windows 95 it total
- crashed! But in Windows for Workgroups 3.11, it recovered a
- couple of runs until it eventually kicked me out to DOS.
-
- I'm running a Pentium 120 with 16megs of RAM. Do I have one of those old
- faulty Pentiums? My system is about one week new.
-
- The code example is EXACTLY as follows:
-
- /* Program to convert a postivie interger to another base */
- #include <stdio.h>
- main ()
- {
- char base_digits[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
- int converted_number[64];
- int number_to_convert;
- int next_digit, base, index = 0;
-
- /* get the number and the base */
-
- printf ("Number to be converted? ");
- scanf ("%ld", &number_to_convert);
- printf ("Base? ");
- scanf ("%i", &base);
-
- /* convert to the indicated base */
-
- do
- {
- converted_number[index] = number_to_convert % base;
- ++index;
- number_to_convert = number_to_convert / base;
- }
- while ( number_to_convert != 0);
-
- /* display the results in reverse order */
-
- printf ("Converted number = ");
-
- for ( index; index >= 0; --index )
- {
- next_digit = converted_number[index];
- printf("%c", base_digits[next_digit]);
- }
-
- printf ("\n");
-
- }
-
- /* Code ends here */
-
-
-
-